﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SEVN.Web.Framework.Modules.Menu
{
    public partial class Menu0401 : System.Web.UI.UserControl
    {
        WebFrameDataContext wf = new WebFrameDataContext();
        int d = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            var cate = from x in wf.Categories
                       where x.CategoryParentID == 0
                       select x;
            rptMenu0401.DataSource = cate;
            rptMenu0401.DataBind();
        }

        protected void rptMenu0401_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            string ID = Request.QueryString["CategoryID"];
            d = Convert.ToInt32(ID);
            HiddenField hf = (HiddenField)e.Item.FindControl("hf");
            Repeater rptChil = (Repeater)e.Item.FindControl("rptChil");
            if (hf != null && rptChil != null)
            {
                var Chil = from x in wf.Categories
                           where x.CategoryParentID.ToString() == hf.Value
                           select x;
                rptChil.DataSource = Chil;
                rptChil.DataBind();
            }
        }
    }
}